package com.copm.ifm.servers.sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.copm.ifm.base.api.pojo.PageDTO;
import com.copm.ifm.base.api.pojo.PageVO;
import com.copm.ifm.base.basic.constant.DbConstants;
import com.copm.ifm.base.basic.util.AuthUtil;
import com.copm.ifm.base.service.mp.page.PageProxy;
import com.copm.ifm.servers.sys.entity.SysServerStandardTip;
import com.copm.ifm.servers.sys.mapper.SysServerStandardTipMapper;
import com.copm.ifm.servers.sys.service.SysServerStandardTipService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * 服务标准和服务提示表 服务实现类
 *
 * @author tp
 * @since 2020-12-31
 */
@Service
public class SysServerStandardTipServiceImpl extends ServiceImpl<SysServerStandardTipMapper, SysServerStandardTip> implements SysServerStandardTipService {

    @Resource
    SysServerStandardTipMapper sysServerStandardTipMapper;

    @Override
    public PageVO<SysServerStandardTip> selectForPage(PageDTO<SysServerStandardTip> param) {
        return PageProxy.proxy(baseMapper::selectForPage,param);
    }

    @Override
    public SysServerStandardTip selectById(int id) {
        return baseMapper.selectById(id);
    }

    @Override
    public int updateDeleted(int id) {
        SysServerStandardTip sysMessageSend = new SysServerStandardTip();
        sysMessageSend.setId(id);
        sysMessageSend.setDeleted(DbConstants.DEFAULT_YES);
        return sysServerStandardTipMapper.updateById(sysMessageSend);
    }

    @Override
    public void updateEntityById(SysServerStandardTip entity) {
        entity.setUpdateBy(AuthUtil.getCurrentUserId());
        entity.setUpdateTime(new Date());
        updateById(entity);
    }
}
